##############################
# MAKE FOR ROTAT
##############################

sys := $(shell uname)
ifneq (,$(findstring CYGWIN,$(strip $(sys))))
   SYSTYPE := "cygwin_f90"
else
#  SYSTYPE := "ifort"
#  SYSTYPE := "lf"
#  SYSTYPE := "g77"
#    SYSTYPE := "gfortran"
   SYSTYPE := "g95"
#  SYSTYPE="par_ifort"
#  SYSTYPE="pgf"
#  SYSTYPE="par_pgf"
#  SYSTYPE := "MPA_f95i"
endif
# SYSTYPE="ifort"
# SYSTYPE="cygwin_ifort"
# SYSTYPE="cygwin_f90"
# SYSTYPE="MPA_f95i"
# SYSTYPE="MPA_f95n"
UnixOrWin = "unix" # default value

########################################
## For Intel fortran
ifeq ($(SYSTYPE),"ifort")
  FC = ifort  # Intel fortran
#   FFLAGS = -c -save -zero -132 -O3 -fpe0 -no-ftz
   FFLAGS = -c -save -zero -132 -O3 -fp-model strict
#   FFLAGS = -c -save -zero -132 -O3 -fpe0 -fp-model strict -g -CB -traceback
# FFLAGS = -c -save -zero -132 -O3
#  FFLAGS = -c -save -zero -132 -fpe0 -no-ftz -CB -g -traceback # -- for debug
  #FFLAGS = -c -O3 -save -zero -tpp7   -ip # -xW # -- optimize for Pentium
  #FFLAGS =   -c -save -static -zero -O2 -fpe0 -no-ftz -traceback # -CB -traceback
  #LDFLAGS = -i-static
#  FFLAGS = -c -save -fpe0 -no-ftz -g -CB -traceback -inline_debug_info  -DD
  LIBS= $(HOME)/lib/libsparse.a $(HOME)/lib/liblnag.a  -lpng -lpgplot -lX11
#   LIBS= $(HOME)/lib/libsparseStr.a $(HOME)/lib/liblnagStr.a  -lpng -lpgplot -lX11
#  LIBDIRSYS =
 LIBSM = /usr/local/lib/libplotsub.a \
       /usr/local/lib/libdevices.a \
       /usr/local/lib/libutils.a -L/usr/lib -lX11

#-lsocket -lnsl

# -L /opt/X11R6.4/lib -lX11

  UnixOrWin := "unix"
endif

########################################
## For Lahey-Fujutsu fortran
ifeq ($(SYSTYPE),"lf")
  FC = lf95  # Lahey-fujutsu fortran
  LDR  = $(FC)
  FFLAGS = -Cpp -c  --sav --ap --o2
#  FFLAGS = -c  --sav -g  --trap  --ap   --chkglobal   --pca # debug
#  FFLAGS = -c  -sav --trap  --tpp   --o2   --ntrace   --f95   --info
#  FFLAGS = -c  -sav  --tpp   --o2   --ntrace   --f95   --info
  LIBS= $(HOME)/lib/libsparself.a $(HOME)/lib/liblnaglf.a  -lpng -lpgplot -lX11
  UnixOrWin := "unix"
endif

########################################
## For Intel fortran
ifeq ($(SYSTYPE),"cygwin_ifort")
  FC = ifl  # Intel fortran
  FFLAGS = -c -save -zero  -tpp7   -ip  -static -fast
#  FFLAGS = -c -O3 -save -zero -tpp7   -ip
#  FFLAGS = -compile_only -static   -architecture:k7 -optimize:5 -fast -tune:k7 # for optimization Pentium
#  FFLAGS = -c -static -debug:full -check:bounds,power,overflow -traceback -list -show:all
  LDFLAGS =
#  LDFLAGS = /libs:static
  LIBS = ..\\lib\\liblnag.a	..\\lib\\libspars.a
  LIBDIRSYS = /I"/cygdrive/c/Program Files/Intel/Compiler70/IA32/Lib/"
#  LIBDIRSYS = /I"/cygdrive/c/Program Files/Intel/Compiler70/IA32/Lib/"
  UnixOrWin := "win"
endif


########################################
## For Visial Compaq Fortran
ifeq ($(SYSTYPE),"cygwin_f90")
  FC = f90  # Compaq fortran
  LINK = link.exe
  # FFLAGS = -compile_only -static  -fast -tune:k7
  LDFLAGS = -architecture:k7 -optimize:5 -fast -tune:k7 # /ignore:505
  FFLAGS = -compile_only -static   -architecture:k7 -optimize:5 -fast -tune:k7 # for optimization Pentium
#  FFLAGS = -c -static -debug:full -check:bounds,power,overflow -traceback -list -show:all
  LIBS = d:\\prg\\lib\\libsparscvf.a d:\\prg\\lib\\liblnagcvf.a
#  LIBS = ..\\lib\\liblnagcvf.a	..\\lib\\libsparscvf.a
  LIBDIRSYS =
#  LIBDIRSYS = /libpath:"c:\\Program Files\\Microsoft Visual Studio\\DF98\\LIB\\" /libpath:"c:\\Program Files\\Microsoft Visual Studio\\VC98\\LIB\\"

#  LIBDIRSYS = "c:/Program Files/Microsoft Visual Studio/DF98/LIB/"
  UnixOrWin := "win"
endif

########################################
## For Intel fortran
ifeq ($(SYSTYPE),"MPA_f95i")
  FC = f95i  # Intel fortran
#  FFLAGS = -c -static -save -zero -fpe0  -check bounds -g -traceback # -- for debug
#  FFLAGS = -c -O3 -save -zero -tpp7   -ip # -xW # -- optimize for Pentium
  FFLAGS = -c -save -zero -O3 -fpe0 -no-ftz
  FFLAGS = -c -save -zero -fpe0  -check bounds -g -traceback # -- for debug
#  FFLAGS = -c -save -zero -132 -O3
  FFLAGS = -c -save -zero -132 -fpe0 -no-ftz -CB -g -traceback # -- for debug
  #LIBS = /afs/ipp/home/s/seb/lib/libsparsifc.a  /afs/ipp/home/s/seb/lib/liblnagifc.a
  LIBS = /afs/mpa/home/seb/lib/libsparse.a /afs/mpa/home/seb/lib/liblnag.a
  LDFLAGS =
  UnixOrWin := "unix"
endif

########################################
## For NAG fortran
ifeq ($(SYSTYPE),"MPA_f95n")
  FC = f95n  # NAG fortran
  FFLAGS = -c  -save
  FFLAGS = -c -O3 -save -f77
  LDFLAGS =
  LIBS = ../lib/libsparsNag.a ../lib/liblnagNag.a	# for NAG
  LIBDIRSYS =
  UnixOrWin := "unix"
endif
########################################
########################################

########################################
## For Portland Group fortran
ifeq ($(SYSTYPE),"pgf")
  FC = pgf95  # pgf fortran
  FFLAGS = -c -fast -Minform,warn -Msave
#  FFLAGS = -c -C -g -Ktrap=fp -Mbounds -Minform,warn -Msave
  LIBS= $(HOME)/lib/libsparse.a $(HOME)/lib/liblnag.a
  LIBDIRSYS =
  UnixOrWin := "unix"
endif
########################################
########################################

########################################
## For Portland Group fortran
ifeq ($(SYSTYPE),"par_pgf")
  FC = pgf95  # pgf fortran
#  FFLAGS = -c -C -g -Ktrap=fp -Mbounds -Minform,warn -Msave
  FFLAGS = -c -fast -Minform,warn -Msave -I/raid/mpich/include
  LIBS= $(HOME)/lib/libsparse.a $(HOME)/lib/liblnag.a
  LDFLAGS = -L /raid/mpich/lib -lmpich -lfmpich
  UnixOrWin := "unix"
endif
########################################

## For g77 fortran
ifeq ($(SYSTYPE),"g77")
  FC = g77  # g77 fortran
  # FFLAGS = -c -O -finit-local-zero -fno-automatic -Wall # for g77
  FFLAGS = -c -O2 -fexpensive-optimizations -finit-local-zero -fno-automatic -Wall
  # FFLAGS = -c -g -fbounds-check -finit-local-zero -fno-automatic # for g77
  LDFLAGS =
  LIBS= ./sparse/g77sparse.a ./lnag/g77lnag.a
  LIBDIRSYS =
  LIBSM = /usr/local/lib/libplotsub.a \
        /usr/local/lib/libdevices.a \
        /usr/local/lib/libutils.a -L/usr/lib -lX11
  UnixOrWin := "unix"
endif
########################################

## For gfortran
ifeq ($(SYSTYPE),"gfortran")
  FC = gfortran
  # FFLAGS = -c -O -finit-local-zero -fno-automatic -Wall # for g77
  FFLAGS = -c -O2 -ffixed-line-length-132 -fexpensive-optimizations -finit-local-zero -fno-automatic -Wall
  # FFLAGS = -c -g -fbounds-check -finit-local-zero -fno-automatic # for g77
  LDFLAGS =
  LIBS= $(HOME)/lib/libsparseGF.a $(HOME)/lib/liblnagGF.a -lpgplot -lpng -lX11
  LIBDIRSYS =
  LIBSM = /usr/local/lib/libplotsub.a \
        /usr/local/lib/libdevices.a \
        /usr/local/lib/libutils.a
  UnixOrWin := "unix"
endif
########################################

## For g95
ifeq ($(SYSTYPE),"g95")
  FC = g95
  # FFLAGS = -c -O -fzero  -Wall 
  FFLAGS = -c -O2 -ffixed-line-length-132 -fstatic -fexpensive-optimizations  -fzero -Wall  -fno-second-underscore 
  # FFLAGS = -c -g -fbounds-check -fzero # for g77
  LDFLAGS =
  LIBS= $(HOME)/lib/libsparseG95.a $(HOME)/lib/liblnagG95.a -lpgplot -lpng -lX11
  LIBDIRSYS =
  LIBSM = /usr/local/lib/libplotsub.a \
        /usr/local/lib/libdevices.a \
        /usr/local/lib/libutils.a
  UnixOrWin := "unix"
endif
########################################

########################################
## For Windows
ifeq ($(UnixOrWin),"win")
 FFLAGS += -object:$@
 LDFLAGS += /exe:
 slash_l := \\
endif
########################################
## For Linux
ifeq ($(UnixOrWin),"unix")
 LDFLAGS += -o
 slash_l := /
endif
#-------------------------------------------------------
#---
#-------------------------------------------------------

PROGNRMROT = nonRotmrot.exe
PROGNRMROT := $(subst /,$(slash_l),$(PROGNRMROT))
FILES_NRMROT = nonRotmrot.trf
OBJS_NRMROT := $(patsubst %.f,%.o, $(FILES_NRMROT:.trf=.f))
CLEAN_NRMROT = nonRotmrot.trf

PROGMROT = mrot.exe
PROGMROT := $(subst /,$(slash_l),$(PROGMROT))
FILES_MROT = mrot.trf
OBJS_MROT := $(patsubst %.f,%.o, $(FILES_MROT:.trf=.f))
CLEAN_MROT = mrot.trf

PROGMROTEOS = mroteos.exe
PROGMROTEOS := $(subst /,$(slash_l),$(PROGMROTEOS))
FILES_MROTEOS = mrotEos.trf eosGamma.f
OBJS_MROTEOS := $(patsubst %.f,%.o, $(FILES_MROTEOS:.trf=.f))
CLEAN_MROTEOS = mrotEos.trf

PROGMROTEOSSEB = mroteosseb.exe
PROGMROTEOSSEB := $(subst /,$(slash_l),$(PROGMROTEOSSEB))
FILES_MROTEOSSEB = mrotEosSeb.trf eosGamma.f # or eosseb.trf
FILES_MROTEOSSEB = mrotEosSeb.trf eosseb.trf
OBJS_MROTEOSSEB := $(patsubst %.f,%.o, $(FILES_MROTEOSSEB:.trf=.f))
CLEAN_MROTEOSSEB = mrotEosSeb.trf

PROGROT = newrot.exe
PROGROT := $(subst /,$(slash_l),$(PROGROT))
FILES_ROT = rotmain.trf rotsubr.trf eosaksenov.trf
OBJS_ROT := $(patsubst %.f,%.o, $(FILES_ROT:.trf=.f))

PROGNRCANRHO = nrcanutorho.exe
PROGNRCANRHO := $(subst /,$(slash_l),$(PROGNRCANRHO))
FILES_NRCANRHO = nonRotrho0Canutomain.trf rotsubr.trf eosaksenov.trf
OBJS_NRCANRHO := $(patsubst %.f,%.o, $(FILES_NRCANRHO:.trf=.f))

PROGCANRHO = canutorho.exe
PROGCANRHO := $(subst /,$(slash_l),$(PROGCANRHO))
FILES_CANRHO = rho0Canutomain.trf rotsubr.trf eosaksenov.trf
OBJS_CANRHO := $(patsubst %.f,%.o, $(FILES_CANRHO:.trf=.f))

PROGCANROT = canutorot.exe
PROGCANROT := $(subst /,$(slash_l),$(PROGCANROT))
FILES_CANROT = rotCanutomain.trf rotsubr.trf eosaksenov.trf
OBJS_CANROT := $(patsubst %.f,%.o, $(FILES_CANROT:.trf=.f))

PROGPOLYT = polytrop.exe
PROGPOLYT := $(subst /,$(slash_l),$(PROGPOLYT))
FILES_POLYT = rotmain.trf rotsubrIR.trf eosGamma.f   # IR means Iterative Refinement
OBJS_POLYT := $(patsubst %.f,%.o, $(FILES_POLYT:.trf=.f))
CLEAN_POLYT = rotmain.trf rotsubrIR.trf

PROGPOLAW = polytlaw.exe
PROGPOLAW := $(subst /,$(slash_l),$(PROGPOLAW))
FILES_POLAW = rotLawmain.trf rotLawIRn.trf eosGamma.f # rotation Law is added as argument
OBJS_POLAW := $(patsubst %.f,%.o, $(FILES_POLAW:.trf=.f))
CLEAN_POLAW = rotLawmain.trf rotLawIRn.trf

PROGTURS = turseb.exe
PROGTURS := $(subst /,$(slash_l),$(PROGTURS))
FILES_TURS = tursEosseb.trf eosseb.trf
OBJS_TURS := $(patsubst %.f,%.o, $(FILES_TURS:.trf=.f))

PROGTURSG = tursgam.exe
PROGTURSG := $(subst /,$(slash_l),$(PROGTURSG))
FILES_TURSG = tursEosgam.trf eosGamma.f
OBJS_TURSG := $(patsubst %.f,%.o, $(FILES_TURSG:.trf=.f))
CLEAN_TURSG = tursEosgam.trf

PROGSEBRHO = sebrho.exe
PROGSEBRHO := $(subst /,$(slash_l),$(PROGSEBRHO))
# FILES_SEBRHO = rho0Sebmain.trf rotsubrIR.trf eosseb.trf
FILES_SEBRHO = rho0Sebmain.trf rotLawIRn.trf eosseb.trf vecsubs.trf plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJS_SEBRHO := $(patsubst %.f,%.o, $(FILES_SEBRHO:.trf=.f))
CLEAN_SEBRHO = rho0Sebmain.trf rotLawIRn.trf eosseb.trf

PROGNRSEBRHO = nrsebrho.exe
PROGNRSEBRHO := $(subst /,$(slash_l),$(PROGNRSEBRHO))
FILES_NRSEBRHO = nrrho0Seb.trf rotLawIRn.trf eosseb.trf  plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJS_NRSEBRHO := $(patsubst %.f,%.o, $(FILES_NRSEBRHO:.trf=.f))
CLEAN_NRSEBRHO = nrrho0Seb.trf rotLawIRn.trf eosseb.trf

PROGMfromJ = findMfromJ.exe
PROGMfromJ := $(subst /,$(slash_l),$(PROGMfromJ))
FILES_MfromJ = findMfromJ.trf
OBJS_MfromJ := $(patsubst %.f,%.o, $(FILES_MfromJ:.trf=.f))

PROGNRRHONP = nrrhoNoPlots.exe
PROGNRRHONP := $(subst /,$(slash_l),$(PROGNRRHONP))
FILES_NRRHONP = nrrho0NoPlots.trf rotLawIRn.trf eosseb.trf  plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJS_NRRHONP := $(patsubst %.f,%.o, $(FILES_NRRHONP:.trf=.f))
CLEAN_NRRHONP = nrrho0NoPlots.trf rotLawIRn.trf eosseb.trf

PROGPOLRHO = polrho.exe
PROGPOLRHO := $(subst /,$(slash_l),$(PROGPOLRHO))
FILES_POLRHO = rho0Sebmain.trf rotLawIRn.trf eosGamma.f
OBJS_POLRHO := $(patsubst %.f,%.o, $(FILES_POLRHO:.trf=.f))

PROGPLOTRT = plotrt.exe # plot in r, theta plane
PROGPLOTRT := $(subst /,$(slash_l),$(PROGPLOTRT))
FILES_PLOTRT = plotPhiRthet.trf plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJS_PLOTRT := $(patsubst %.f,%.o, $(FILES_PLOTRT:.trf=.f))
CLEAN_PLOTRT = plotPhiRthet.trf

PROGPLOT = plot2rot.exe # main plotting in cylinder coordinates
PROGPLOT := $(subst /,$(slash_l),$(PROGPLOT))
FILES_PLOT = plot2rot.trf plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJS_PLOT := $(patsubst %.f,%.o, $(FILES_PLOT:.trf=.f))
CLEAN_PLOT = plot2rot.trf

PROGAK1D = akimarot1.exe
PROGAK1D := $(subst /,$(slash_l),$(PROGAK1D))
FILESAK1D = akimarot.trf akima.new.f tripack.f plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJSAK1D := $(patsubst %.f,%.o, $(FILESAK1D:.trf=.f))
CLEAN_AK1D = akimarot.trf

PROGAK2D = akimarot2.exe
PROGAK2D := $(subst /,$(slash_l),$(PROGAK2D))
FILESAK2D = akimarot2.trf akima.new.f tripack.f plot2db3.f pgcell.f dsqinf.f pgxtalm.f
OBJSAK2D := $(patsubst %.f,%.o, $(FILESAK2D:.trf=.f))
CLEAN_AK2D = akimarot2.trf

DEL = rm -f

TREFOR = trf

# for ctrf:
TRFFLAGS = -nfs

.IGNORE:
%.o : %.trf
	$(TREFOR) $(TRFFLAGS) $<
	$(FC) $(FFLAGS) $(subst /,$(slash_l),$(patsubst %.trf,%.f,$<))

#.SUFFIXES: $(SUFFIXES) .f

%.o: %.f
	$(FC) $(FFLAGS) $(subst /,$(slash_l),$<)

%.mod : %.o
	@if [! -f $@ ]; then \
	  rm $< \
	  $(MAKE) $< \
	fi

%.o : %.f90
	$(FC) $(FFLAGS) $(subst /,$(slash_l),$<)


all: help
	@echo current compiler: $(FC)
	@echo and its options : $(FFLAGS)

nrmrot: $(OBJS_NRMROT)
	$(FC) $(LDFLAGS) $(PROGNRMROT) $(OBJS_NRMROT) $(LIBS) $(LIBDIRSYS)

mrot: $(OBJS_MROT)
	$(FC) $(LDFLAGS) $(PROGMROT) $(OBJS_MROT) $(LIBS) $(LIBDIRSYS)

mroteos: $(OBJS_MROTEOS)
	$(FC) $(LDFLAGS) $(PROGMROTEOS) $(OBJS_MROTEOS) $(LIBS) $(LIBDIRSYS)

mroteosseb: $(OBJS_MROTEOSSEB)
	$(FC) $(LDFLAGS) $(PROGMROTEOSSEB) $(OBJS_MROTEOSSEB) $(LIBS) $(LIBDIRSYS)

rot: $(OBJS_ROT)
	$(FC) $(LDFLAGS) $(PROGROT) $(OBJS_ROT) $(LIBS) $(LIBDIRSYS)

nrcanutorho: $(OBJS_NRCANRHO)
	$(FC) $(LDFLAGS) $(PROGNRCANRHO) $(OBJS_NRCANRHO) $(LIBS) $(LIBDIRSYS)

canutorho: $(OBJS_CANRHO)
	$(FC) $(LDFLAGS) $(PROGCANRHO) $(OBJS_CANRHO) $(LIBS) $(LIBDIRSYS)

canutorot: $(OBJS_CANROT)
	$(FC) $(LDFLAGS) $(PROGCANROT) $(OBJS_CANROT) $(LIBS) $(LIBDIRSYS)

polytrop: $(OBJS_POLYT)
	$(FC) $(LDFLAGS) $(PROGPOLYT) $(OBJS_POLYT) $(LIBS) $(LIBDIRSYS)

polytlaw: $(OBJS_POLAW)
	$(FC) $(LDFLAGS) $(PROGPOLAW) $(OBJS_POLAW) $(LIBS) $(LIBDIRSYS)

turs: $(OBJS_TURS)
	$(FC) $(LDFLAGS) $(PROGTURS) $(OBJS_TURS)

tursgam: $(OBJS_TURSG)
	$(FC) $(LDFLAGS) $(PROGTURSG) $(OBJS_TURSG)

sebrho: $(OBJS_SEBRHO)
	$(FC) $(LDFLAGS) $(PROGSEBRHO) $(OBJS_SEBRHO) $(LIBS) $(LIBSM) $(LIBDIRSYS)

MfromJ: $(OBJS_MfromJ)
	$(FC) $(LDFLAGS) $(PROGMfromJ) $(OBJS_MfromJ) $(LIBS) $(LIBDIRSYS)

nrsebrho: $(OBJS_NRSEBRHO)
	$(FC) $(LDFLAGS) $(PROGNRSEBRHO) $(OBJS_NRSEBRHO) $(LIBS) $(LIBDIRSYS)

nrrhonp: $(OBJS_NRRHONP)
	$(FC) $(LDFLAGS) $(PROGNRRHONP) $(OBJS_NRRHONP) $(LIBS) $(LIBDIRSYS)

polrho: $(OBJS_POLRHO)
	$(FC) $(LDFLAGS) $(PROGPOLRHO) $(OBJS_POLRHO) $(LIBS) $(LIBDIRSYS)

plotrt: $(OBJS_PLOTRT)
	$(FC) $(LDFLAGS) $(PROGPLOTRT) $(OBJS_PLOTRT) $(LIBS)

plot: $(OBJS_PLOT)
	$(FC) $(LDFLAGS) $(PROGPLOT) $(OBJS_PLOT) $(LIBS)

akima1: $(OBJSAK1D)
	$(FC) $(LDFLAGS) $(PROGAK1D)  $(OBJSAK1D) $(LIBS)

akima2: $(OBJSAK2D)
	$(FC) $(LDFLAGS) $(PROGAK2D)  $(OBJSAK2D) $(LIBS)

help:
	@echo "You can do: "
	@echo " nrmrot         --  compile non-rot mrot test for polytropes"
	@echo " mrot           --  compile mrot for polytropes"
	@echo " mroteos        --  compile mroteos for arbitrary EoS"
	@echo " mroteosseb     --  compile mroteosseb for rho-seq and any EoS"
	@echo " rot            --  compile newrot"
	@echo " nrcanutorho    --  compile non-rot-canutorho: rho0 series"
	@echo " canutorho      --  compile canutorho: rho0 series"
	@echo " canutorot      --  compile canutorot: IB series"
	@echo " polytrop       --  compile polytrop with alpha-law"
	@echo " polytlaw       --  compile polytrop with rot law"
	@echo " turs           --  compile tursEosseb.trf eosseb.trf "
	@echo " tursgam        --  compile tursEosgam.trf eosGamma.f "
	@echo " sebrho         --  compile sebrho: rho0 series"
	@echo " MfromJ         --  compile findMfromJ given rho in rho0MJ.out find M for fixed J"
	@echo " nrsebrho       --  compile non-rot nrsebrho: rho0 series"
	@echo " nrrhonp        --  compile non-rot rho0 series No Plot files"
	@echo " polrho         --  compile polrho: rho0 series for polytropes"
	@echo " plotrt         --  compile plotrt in r, theta plane"
	@echo " plot           --  compile plot2rot main plotting"
	@echo " akima1         --  compile akimarot1"
	@echo " akima2         --  compile akimarot2"
	@echo " cleandata      --  DEL nohup.out core* fort.*"
	@echo " clean          --  DEL *.o *.il and *.f from trf"
	@echo " cleanall       --  DEL PROGROT *.o *.il  *.mod *.lst"
	@echo " help           --  print this help"

#
# Here are all the dependencies:
#


######
# ROTAT
######
nonRotmrot.o    :  nonRotmrot.trf PPMA.inc STATD.inc
mrot.o          :  mrot.trf PPMA.inc STATD.inc
mrotEos.o       :  mrotEos.trf PPMA.inc statd.for
mrotEosSeb.o    :  mrotEosSeb.trf PPMA.inc WDunits.inc grid.inc
rotmain.o       :  rotmain.trf  accur.for statd.for
nonRotrho0Canutomain.o : nonRotrho0Canutomain.trf accur.for statd.for
rho0Canutomain.o:  rho0Canutomain.trf  accur.for statd.for
rotCanutomain.o :  rotCanutomain.trf  accur.for statd.for
rho0Sebmain.o   :  rho0Sebmain.trf  accur.inc grid.inc WDunits.inc # statd.for units.inc
findMfromJ.o    :  findMfromJ.trf
nrrho0Seb.o     :  nrrho0Seb.trf  accur.inc grid.inc WDunits.inc # statd.for units.inc
nrrho0NoPlots.o :  nrrho0NoPlots.trf  accur.inc grid.inc WDunits.inc # statd.for units.inc
rotLawmain.o    :  rotLawmain.trf  accur.inc grid.inc # statd.for
rotsubr.o       :  rotsubr.trf  accur.for grid.inc # statd.for
rotsubrIR.o     :  rotsubrIR.trf  accur.inc grid.inc # statd.for
rotLawIRn.o     :  rotLawIRn.trf  accur.inc grid.inc # statd.for
eosaksenov.o    :  eosaksenov.trf accur.for
eosseb.o        :  eosseb.trf WDunits.inc
eosGamma.o      :  eosGamma.f accur.for
stat1.o         :  stat1.f  accur.for statd.for
stat1fdat.o     :  stat1fdat.f  accur.for statd.for
stat2.o         :  stat2.f  accur.for statd.for
vecsubs.o       :  vecsubs.trf
######
# TEST
######
tursEosseb.o    :  tursEosseb.trf units.inc
tursEosgam.o    :  tursEosgam.trf units.inc

######
# PLOT
######
plot2rot.o      :  plot2rot.trf plotrot.inc  grid.inc # statd.for
akimarot.o      :  akimarot.trf
akimarot2.o     :  akimarot2.trf
akima.new.o     :  akima.new.f
tripack.o       :  tripack.f
plot2db3.o      :  plot2db3.f
pgcell.o        :  pgcell.f
dsqinf.o        :  dsqinf.f
pgxtalm.o       :  pgxtalm.f

cleandata:
	$(DEL) nohup.out core* fort.*

clean:
	$(DEL) *.o  *.il
	$(DEL) $(CLEAN_POLYT:.trf=.f) $(CLEAN_POLAW:.trf=.f) $(FILES_TURS:.trf=.f) \
	       $(CLEAN_MROT:.trf=.f) $(CLEAN_MROTEOS:.trf=.f) $(CLEAN_MROTEOSSEB:.trf=.f) \
	       $(FILES_ROT:.trf=.f) $(FILES_CANRHO:.trf=.f)  $(FILES_CANROT:.trf=.f) \
	       $(CLEAN_PLOT:.trf=.f) $(CLEAN_PLOTRT:.trf=.f) $(CLEAN_TURSG:.trf=.f) \
		$(CLEAN_SEBRHO:.trf=.f) $(CLEAN_NRSEBRHO:.trf=.f) $(CLEAN_NRRHONP:.trf=.f) \
		$(CLEAN_AK1D:.trf=.f) $(CLEAN_AK2D:.trf=.f)


cleanall:
	$(DEL) $(PROGROT) $(PROGCANRHO) $(PROGCANROT) $(PROGPOLYT) $(PROGPOLAW) \
	$(PROGTURS) $(PROGTURSG) $(PROGPLOT)  $(PROGMROT) $(PROGMROTEOS) \
	$(PROGSEBRHO) $(PROGPOLRHO)  *.o  *.il
	$(DEL) $(CLEAN_POLYT:.trf=.f) $(CLEAN_POLAW:.trf=.f) $(FILES_TURS:.trf=.f) \
	       $(CLEAN_MROT:.trf=.f) $(CLEAN_MROTEOS:.trf=.f) \
	       $(FILES_ROT:.trf=.f) $(FILES_CANRHO:.trf=.f)  $(FILES_CANROT:.trf=.f) \
	       $(CLEAN_PLOT:.trf=.f) $(CLEAN_PLOTRT:.trf=.f)  $(CLEAN_TURSG:.trf=.f) \
		$(CLEAN_SEBRHO:.trf=.f) $(CLEAN_NRSEBRHO:.trf=.f) $(CLEAN_NRRHONP:.trf=.f) \
		$(CLEAN_AK1D:.trf=.f) $(CLEAN_AK2D:.trf=.f)
	$(DEL) *.mod *.lst
